import 'package:share_fit/app/controllers/base/base_controller.dart';
import 'package:share_fit/app/controllers/space/setting/setting_state.dart';
import 'package:share_fit/app/ute/uteped_const.dart';

class SettingLogic extends BaseController {

  final SettingState state = SettingState();

  void setShowConnect(bool show) {
    state.showConnect = show;
    update(["setting_unit_sel"]);
  }

  void setLength(int len) {
    state.length = len;
    update(["setting_length_sel"]);
  }

  void setWeight(int weight) {
    state.weight = weight;
    update(["setting_weight_sel"]);
  }

  void setTemp(int temp) {
    state.temp = temp;
    update(["setting_temp_sel"]);
  }

  @override
  String getRemotePath() {
    return SettingState.REMOTE_PATH;
  }

  @override
  void initState() {
    // TODO: implement initState
  }

  @override
  void onRemoteEvent(event, method) {
    // TODO: implement onRemoteEvent
  }

  Future<void> setTemperatureUnit(Map<String, Object> params, {required Null Function(dynamic _) back}) async {
    var result = await sRemoteReqAsync(UTEPedConst.methodSetTemperatureUnit, params);
    back(result);
  }

  Future<void> setWeightUnits(Map<String, Object> params, {required Null Function(dynamic _) back}) async {
    var result = await sRemoteReqAsync(UTEPedConst.methodSetWeightUnits, params);
    back(result);
  }

  Future<void> setLanguage(Map<String, Object> params, {required Null Function(dynamic _) back}) async {
    var result = await sRemoteReqAsync(UTEPedConst.methodSetLanguage, params);
    back(result);
  }

}